針對Project1- Finding Lane Lines這個項目,提供專案實作說明,包括以下三個部分:
1.程式實作描述
2.可能缺點
3.建議可能的改進
def process_image(image):
# NOTE: The output you return should be a color image (3 channel) for processing video below
# TODO: put your pipeline here,
# you should return the final output (image where lines are drawn on lanes)
gray_image = grayscale(image)
gaus_blur = gaussian_blur(gray_image, 3)
edges = canny(gaus_blur, 50,150)
imshape = image.shape
vertices = np.array([[(0,imshape[0]),(450, 320), (500, 320), (imshape[1],imshape[0])]], dtype=np.int32)
masked = region_of_interest(edges, vertices)
rho = 2 #distance resolution in pixels of the Hough grid
theta = np.pi/180 #angular resolution in radians of the Hough grid
threshold = 5 #minimum number of votes (intersections in Hough grid cell)
min_line_len = 10 #minimum number of pixels making up a line
max_line_gap = 20 #maximum gap in pixels between connectable line segments
line_image = hough_lines(masked, rho, theta, threshold, min_line_len, max_line_gap)
result = weighted_img(line_image, image)
return result
gray_image = grayscale(image)
2.高斯平滑處理
gray_image = grayscale(image)
3.利用canny檢測邊緣
edges = canny(gaus_blur, 50,150)
4.於圖檔繪上興趣節點
masked = region_of_interest(edges, vertices)
5.圖檔進行霍夫轉換產出
line_image = hough_lines(masked, rho, theta, threshold, min_line_len, max_line_gap)
在可能車道道之取得,利用斜率範圍過濾取得,實際上車道線在圖檔上不一定會直線,可能因為會有不是車道線會納入考量,也可能漏掉可能的車道線。
將車道線之取得把圖檔切割更小範圍來進行判斷